<?php
$profileId=$_SESSION['profileid'];
$startDate;
$endDate;
$dimension;
?>

<div class = "row" >
<?php
$CLParams = array(
      'dimensions' => 'ga:adGroup',
      
      
		);
$resultsCL = $analytics->data_ga->get(
       'ga:' . $profileId,
       '2014-12-06',
       '2014-12-21',
	   'ga:adClicks',
       $CLParams
	   );
	   

 ?>
<script type="text/javascript">
        var chartData2 = [
		<?php
    // Print table rows.
		$x=1;
		foreach ($resultsCL->getRows() as $row) {
      
		?>
                {
                    "Grup Iklan": "<?php echo $row[0]; ?>",
                    "Clicks": <?php echo $row[1]+80; ?>
                }
		<?php
		if($x>=sizeof($resultsCL->getRows()))
		{
		?>
		<?php
		}
		else
		{
		?>
		,
		<?php
		}
		$x++;
     
		}
?>
        ];
</script>	
</div>
<script src="amcharts/amcharts.js" type="text/javascript"></script>
        <script src="amcharts/serial.js" type="text/javascript"></script>

<script type="text/javascript">
            var chartb;

            AmCharts.ready(function () {
                // SERIAL CHART
                chartb = new AmCharts.AmSerialChart();
                chartb.dataProvider = chartData2;
                chartb.categoryField = "Grup Iklan";
                chartb.startDuration = 1;

                // AXES
                // category
                var categoryAxisb = chartb.categoryAxis;
                categoryAxisb.labelRotation = 90;
                categoryAxisb.gridPosition = "start";

                // value
                // in case you don't want to change default settings of value axis,
                // you don't need to create it, as one value axis is created automatically.

                // GRAPH
                var graphb = new AmCharts.AmGraph();
                graphb.valueField = "Clicks";
                graphb.balloonText = "[[category]]: <b>[[value]]</b>";
                graphb.type = "column";
                graphb.lineAlpha = 0;
                graphb.fillAlphas = 0.8;
                chartb.addGraph(graphb);

                // CURSOR
                var chartCursorb = new AmCharts.ChartCursor();
                chartCursorb.cursorAlpha = 0;
                chartCursorb.zoomable = false;
                chartCursorb.categoryBalloonEnabled = false;
                chartb.addChartCursor(chartCursorb);

                chartb.creditsPosition = "top-right";

                chartb.write("chartb");
            });
</script>

<div class = "row" >

<div id="chartb" style="width: 100% ; height: 400px;"></div>
</div>







